package com.github.edu.db.server.api.service;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 表字段管理
 * Create by IntelliJ IDEA
 * 用户：王建
 * 日期：2018-7-30
 */
public interface TableFieldManagerServiceApi {


    /**
     * 查询单个组建授权
     * @param id 服务编号
     * @return 授权详情信息
     */
    @GetMapping("/rest/api/field/manager/entity")
    String getEntity(@RequestParam("id")String id);

    /**
     * 保存或者更新服务授权信息
     * @param jsonEntity 保存对象json字符串
     * @return
     */
    @PostMapping("/rest/api/field/manager/saveOrUpdate")
    String saveOrUpdate(@RequestBody String jsonEntity);

    /**
     * GET 分页查询
     * @param title 一般用于服务名称之类的模糊查询
     * @param current 第几页
     * @param rows 每页几条
     * @param order 排序字段和排序方式，用‘;’号分开 key1,key2,...:value
     * @param fileId 用于条件查询，多个字段用‘;’号分开 key1:value;key2:value...
     * @return jsonArray json对象
     */
    @GetMapping("/rest/api/field/manager/list/get")
    String getAllByPager(@RequestParam(name = "title",defaultValue = "",required = false)String title,
                         @RequestParam(name = "current",defaultValue = "1",required = false)Integer current,
                         @RequestParam(name = "rows",defaultValue = "10",required = false)Integer rows,
                         @RequestParam(name = "order",defaultValue = "",required = false)String order,
                         @RequestParam(name="fileId",defaultValue = "",required = false)String fileId);

    /**
     * post查询对象
     * @param jsonEntity json 对象，里面包含 分页信息，和查询信息
     * @return jsonArray json对象
     */
    @PostMapping("/rest/api/field/manager/list/post")
    String getALLByPager(@RequestBody String jsonEntity);


    /**
     * get 查询对象，不分页
     * @param title  一般用于服务名称之类的模糊查询
     * @param order 排序字段和排序方式，用‘;’号分开 key1:value;key2:value
     * @param fileId 用于条件查询，多个字段用‘;’号分开 key1:value;key2:value
     * @return jsonArray json对象
     */
    @GetMapping("/rest/api/field/manager/list/all")
    String getAllEntity(@RequestParam(name = "title",defaultValue = "",required = false)String title,
                        @RequestParam(name = "order",defaultValue = "",required = false)String order,
                        @RequestParam(name="fileId",defaultValue = "",required = false)String fileId);

    /**
     * 删除操作
     * @param ids 删除对象集合
     * @return 删除结果，包含删除对象数目
     */
    @GetMapping("/rest/api/field/manager/delete")
    String deleteAll(@RequestParam(name = "ids",defaultValue = "")String ids);

}
